import request from '@/utils/request'

// 查询客户档案列表
export function listBizCustomer (query) {
  return request({
    url: '/biz/bizCustomer/list',
    method: 'get',
    params: query
  })
}

export function listAllBizCustomer (query) {
  return request({
    url: '/biz/bizCustomer/allList',
    method: 'get',
    params: query
  })
}

// 查询客户档案详细
export function getBizCustomer (id) {
  return request({
    url: '/biz/bizCustomer/' + id,
    method: 'get'
  })
}

// 新增客户档案
export function addBizCustomer (data) {
  return request({
    url: '/biz/bizCustomer',
    method: 'post',
    data: data
  })
}

// 修改客户档案
export function updateBizCustomer (data) {
  return request({
    url: '/biz/bizCustomer',
    method: 'put',
    data: data
  })
}

// 删除客户档案
export function delBizCustomer (id) {
  return request({
    url: '/biz/bizCustomer/' + id,
    method: 'delete'
  })
}

// 校验客户名称是否存在
export function checkCustomerNameUnique (id, customerName) {
  if (id === undefined) {
    id = ''
  }
  return request({
    url: '/biz/bizCustomer/checkCustomerNameUnique/' + customerName + '/' + id,
    method: 'get'
  })
}

// 导出客户档案
export function exportBizCustomer (query) {
  return request({
    url: '/biz/bizCustomer/export',
    method: 'get',
    params: query
  })
}

// 获取初始化数据
export function getInitData (dictTypes) {
  return request({
    url: '/biz/bizCustomer/getInitData/' + dictTypes,
    method: 'get'
  })
}
